<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>注册</title>


    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" href="bitStyle/skin/main.css">
    <script src="bitStyle/skin/jquery-1.10.2.min.js"></script>
    <script src="bitStyle/skin/layer.js"></script><link rel="stylesheet" href="bitStyle/skin/layer.css" id="layui_layer_skinlayercss" style="">
    <script src="bitStyle/skin/foundation.js"></script>
    <script src="bitStyle/skin/my.js"></script>

    <script>
        $(function() {
            $('.checkbox-icon').on('click', function() {
                $(this).toggleClass('sel');
            });
            $('input').on('focus', function() {
                $(this).closest('div').css('border-color', '#20ac19');
            }).on('blur', function() {
                var $this = $(this);
                $this.closest('div').css('border-color', '#d1d1d1');
                setTimeout(function() { $this.closest('div').removeAttr('style'); }, 500);
            });
        });

        //获取手机验证码
        function GetSecurityCode() {
            var i = layer.load(2);
            var mobile =$.trim($("#txtMobile").val()) ;
            if(!isMobile(mobile)) {
                layer.msg("手机号格式不正确");
                $("#txtMobile").focus();
                layer.close(i);
                return;
            } else {
                var param = {
                    phone: mobile
                }
                $.post("/Home/Reg/sendPhone2.html", param, function (result) {
                    layer.close(i);
                    layer.msg(result.message);
                    if (result.success) {
                        //按钮倒计时
                        wait = 120;
                        setCodeTime();
                        $('#txtPhoneCode').focus();
                    }
                });
            }
        }

        //验证码倒计时
        var wait = 120;

        function setCodeTime() {
            var $this = $(".send-yzm");
            if (wait == 0) {
                $this.html("发送验证码");
                $this.attr("disabled", false);
                $this.addClass("gray");
                wait = 120;
            } else {
                $this.html(wait + " S");
                $this.attr("disabled", true);
                $this.removeClass("gray");
                wait--;
                setTimeout(function() {
                    setCodeTime();
                }, 1000);
            }
        }

        //验证数据的完整性
        function VerificationForm(i) {

            if (isNull($("#txtMobile").val())) {

                layer.msg("请输入手机号");
                layer.close(i);
                return false;
            } else if (!isMobile($("#txtMobile").val())) {
                layer.msg("手机格式不正确");

                layer.close(i);
                return false;
            }

            if (isNull($("#txtPhoneCode").val())) {
               // $("#txtPhoneCode").focus();
				layer.msg("请输入验证码");
                layer.close(i);
                return false;
            }

            if (isNull($("#txtUserPwd").val())) {

                layer.msg("请输入密码");
                layer.close(i);
                return false;

            } else {
                if (!isPwd($("#txtUserPwd").val())) {

                    layer.msg("6-16位字符、可包含特殊字符");
                    layer.close(i);
                    return false;
                }
            }

            if (isNull($('#reUserPwd').val())) {

                layer.msg("请输入确认密码");
                layer.close(i);
                return false;
            } else {
                if ($('#reUserPwd').val() != $("#txtUserPwd").val()) {
                    layer.msg("两密码不一致");
                    $("#reUserPwd").val('');
                    layer.close(i);
                    return false;
                }
            }

            if (isNull($('#recommendCode').val())) {
              //  $("#recommendCode").focus();
                layer.msg("请输入邀请码");
                layer.close(i);
                return false;
            }

            if(!$('.checkbox-icon').hasClass("sel")) {
                layer.msg("请同意服务协议");
                layer.close(i);
                return false;
            }

            return true;
        }

        function submitRegister() {
            var i = layer.load(2);
            if(VerificationForm(i)) {
                var param = {
                    mobile: $.trim($("#txtMobile").val()),
                    code: $.trim($("#txtPhoneCode").val()),
                    pwd: $.trim($("#txtUserPwd").val()),
                    pwd2: $.trim($("#reUserPwd").val()),
                    recommendCode: $.trim($('#recommendCode').val()),
                }

                $.post("/Home/Reg/regAjax.html", param, function(result) {
                    layer.close(i);
                    if (result.success == true) {
                        layer.msg(result.message);
                        wait = 0;
                        window.location.href = "/Home/Rmq/Index";
                    } else {
                        layer.msg(result.message);
                    }
                });
            }
        }
    </script>

</head>
<body style="">

<div class="wrapper">
      <script>
    function back(){
        window.history.back();
    }
</script>
<style>
    .wrapper .mystyle{background-color:#6AA84F;text-align: center;font-weight: bold; color: #ffffff;
        padding: .4rem 3%; width: 94%; }
    .wrapper .mystyle img{float: left;  height: 100%; }
    .wrapper .notice,.article ,.joinfb,.w33,.my-friend001,.ljjcjj,.pt20,.swiper-container,.myforget,.myreg{margin-top: 1.8rem;}

    .weixin-set,.ewm{margin-top: 2.6rem;}
    .my-money001{margin-top: 2.2rem;}

</style>
<div class="header mystyle"><img onclick="back();" src="bitStyle/skin/back.png">人脉圈</div>

    <div class="main myreg">
    
        <div class="form-list txt-gray">
            <div class="form-input">
                <i class="user-icon"></i>
                <input type="text" placeholder="请输入手机号" id="txtMobile" maxlength="11">
            </div>
            <div class="form-input">
                <i class="yzm-icon"></i>
                <input type="text" placeholder="请输入验证码" id="txtPhoneCode" maxlength="10">
                <button class="send-yzm" onclick="GetSecurityCode() ">发送验证码</button>
                <!-- 按钮置灰加gray类名 -->
            </div>
            <div class="form-input">
                <i class="pwd-icon"></i>
                <input type="password" placeholder="请设置密码" id="txtUserPwd" maxlength="16">
            </div>
            <div class="form-input">
                <i class="pwd-icon"></i>
                <input type="password" placeholder="请确认密码" id="reUserPwd" maxlength="16">
            </div>
            <div class="form-input">
                <i class="yqm-icon"></i>
                <input type="text" placeholder="请输入邀请码(必填)" value="" id="recommendCode" maxlength="8">
            </div>
            <div class="checkbox ml10">
                <i class="checkbox-icon sel"></i>
                已阅读并同意 <a href="/home/index/newspage2/id/64.html">注册协议</a>
            </div>
            <input class="submit-f-btn mt20" type="submit" value="立即注册" onclick="submitRegister(); ">
            <div class="other-crl mt20 txt-center">已有账号，<a href="/home/login.html">立即登录</a>
            </div>
                    </div>
    </div>
</div>




</body></html>